/**
 * Copyright (C) 2018-2019
 * All rights reserved, Designed By www.joolun.com
 */
package com.ruoyi.mall.controller;

import com.ruoyi.mall.api.RemoteGoodsCategoryService;
import com.ruoyi.mall.api.constant.CommonConstants;
import com.ruoyi.mall.api.entity.GoodsCategory;
import com.ruoyi.mall.utils.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 商品类目
 *
 * @author www.joolun.com
 * @date 2019-08-12 11:46:28
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/weixin/api/ma/goodscategory")
@Api(value = "goodscategory", tags = "商品类目API")
public class GoodsCategoryApi {
    @DubboReference
    private final RemoteGoodsCategoryService goodsCategoryService;

    /**
     * 返回树形集合
     */
    @ApiOperation(value = "返回树形集合")
    @GetMapping("/tree")
    public AjaxResult goodsCategoryTree(GoodsCategory goodsCategory) {
        goodsCategory.setEnable(CommonConstants.YES);
        return AjaxResult.success(goodsCategoryService.selectTree(goodsCategory));
    }
}
